package com.bw.mvvm_common.utils;

import android.content.SharedPreferences;

import com.bw.mvvm_common.BaseApplication;

/**
 * @author KK
 * @description:
 * @date :2021/10/13 15:11
 * 临时存储token
 */
public class SPUtils {

    //存入
    public static void writeToken(String value){
        SharedPreferences sp = BaseApplication.getApplication().getSharedPreferences("catch", 0);
        sp.edit().putString("token",value).commit();

    }

    //读取
    public static String readToken(){
        SharedPreferences sp = BaseApplication.getApplication().getSharedPreferences("catch", 0);
         return sp.getString("token","");
    }

    //判断是否登录
    public static boolean islogin(){
        SharedPreferences sp = BaseApplication.getApplication().getSharedPreferences("catch", 0);
        return  sp.edit().putBoolean("boolean",true).commit();
    }

    //取
    public static boolean readislogin(){
        SharedPreferences sp = BaseApplication.getApplication().getSharedPreferences("catch", 0);
        return sp.getBoolean("boolean",false);
    }
}
